{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 在ArcPy中获取Geometry空间参考相关的信息"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 知识点"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. 通过Describe获取空间参考的信息\n",
    "2. 可以直接通过SpatialReference 类来（创建）获得空间参考"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import arcpy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "shp1 = \"../data/beijing/bj_area.shp\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "desc = arcpy.Describe(shp1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 用Describe类的spatialReference方法，可以获得空间参考类"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Geographic Coordinate System)\">name (Geographic Coordinate System)</td><td title=\"GCS_WGS_1984\">GCS_WGS_1984</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"4326\">4326</td></tr><tr><td id = \"td0\" title=\"angularUnitName (Angular Unit)\">angularUnitName (Angular Unit)</td><td title=\"Degree\">Degree</td></tr><tr><td id = \"td0\" title=\"datumName (Datum)\">datumName (Datum)</td><td title=\"D_WGS_1984\">D_WGS_1984</td></tr></table>"
      ],
      "text/plain": [
       "<geoprocessing spatial reference object at 0x1ef6038dbb0>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sr = desc.spatialReference\n",
    "sr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class SpatialReference in module arcpy.arcobjects.arcobjects:\n",
      "\n",
      "class SpatialReference(arcpy.arcobjects.mixins.SpatialReferenceMixin, arcpy.arcobjects._base._BaseArcObject)\n",
      " |  SpatialReference(item=None, vcs=-1, text=None)\n",
      " |  \n",
      " |  Each part of the spatial reference has a number of properties (especially\n",
      " |  the coordinate system) that defines what map projection options are used\n",
      " |  to define horizontal coordinates.\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      SpatialReference\n",
      " |      arcpy.arcobjects.mixins.SpatialReferenceMixin\n",
      " |      arcpy.arcobjects._base._BaseArcObject\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  create(self, *args)\n",
      " |      SpatialReference.create()\n",
      " |      \n",
      " |      Creates the spatial reference object using properties.\n",
      " |  \n",
      " |  createFromFile(self, *args)\n",
      " |      SpatialReference.createFromFile(prj_file)\n",
      " |      \n",
      " |      Creates the spatial reference object from a projection file.\n",
      " |      \n",
      " |        prj_file(String):\n",
      " |      The projection file used to populate the spatial reference object.\n",
      " |  \n",
      " |  exportToString(self, *args)\n",
      " |      SpatialReference.exportToString()\n",
      " |      \n",
      " |      Exports the object to its string representation.\n",
      " |  \n",
      " |  loadFromString(self, *args)\n",
      " |      SpatialReference.loadFromString(string)\n",
      " |      \n",
      " |      Restore the object using its string representation.     The\n",
      " |      exportToString method can be used to create a string representation.\n",
      " |      \n",
      " |        string(String):\n",
      " |      The string representation of the object.\n",
      " |  \n",
      " |  setDomain(self, *args)\n",
      " |      SpatialReference.setDomain(x_min, x_max, y_min, y_max)\n",
      " |      \n",
      " |      Sets the XY domain.\n",
      " |      \n",
      " |        x_min(Double):\n",
      " |      The minimum x-value.\n",
      " |      \n",
      " |        x_max(Double):\n",
      " |      The maximum x-value.\n",
      " |      \n",
      " |        y_min(Double):\n",
      " |      The minimum y-value.\n",
      " |      \n",
      " |        y_max(Double):\n",
      " |      The maximum y-value.\n",
      " |  \n",
      " |  setFalseOriginAndUnits(self, *args)\n",
      " |      SpatialReference.setFalseOriginAndUnits(false_x, false_y, xy_units)\n",
      " |      \n",
      " |      Sets the XY false origin and units.\n",
      " |      \n",
      " |        false_x(Double):\n",
      " |      The false x value.\n",
      " |      \n",
      " |        false_y(Double):\n",
      " |      The false y value.\n",
      " |      \n",
      " |        xy_units(String):\n",
      " |      The xy units.\n",
      " |  \n",
      " |  setMDomain(self, *args)\n",
      " |      SpatialReference.setMDomain(m_min, m_max)\n",
      " |      \n",
      " |      Sets the M domain.\n",
      " |      \n",
      " |        m_min(Double):\n",
      " |      The minimum m-value.\n",
      " |      \n",
      " |        m_max(Double):\n",
      " |      The maximum m-value.\n",
      " |  \n",
      " |  setMFalseOriginAndUnits(self, *args)\n",
      " |      SpatialReference.setMFalseOriginAndUnits(false_m, m_units)\n",
      " |      \n",
      " |      Sets the M false origin and units.\n",
      " |      \n",
      " |        false_m(Double):\n",
      " |      The false m-value.\n",
      " |      \n",
      " |        m_units(Double):\n",
      " |      The m units.\n",
      " |  \n",
      " |  setZDomain(self, *args)\n",
      " |      SpatialReference.setZDomain(z_min, z_max)\n",
      " |      \n",
      " |      Sets the Z domain.\n",
      " |      \n",
      " |        z_min(Double):\n",
      " |      The minimum z-value.\n",
      " |      \n",
      " |        z_max(Double):\n",
      " |      The maximum z-value.\n",
      " |  \n",
      " |  setZFalseOriginAndUnits(self, *args)\n",
      " |      SpatialReference.setZFalseOriginAndUnits(false_z, z_units)\n",
      " |      \n",
      " |      Sets the Z false origin and units.\n",
      " |      \n",
      " |        false_z(Double):\n",
      " |      The false z-value.\n",
      " |      \n",
      " |        z_units(Double):\n",
      " |      The false z units.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  GCS\n",
      " |  \n",
      " |  GCSCode\n",
      " |  \n",
      " |  GCSName\n",
      " |  \n",
      " |  MDomain\n",
      " |  \n",
      " |  MFalseOriginAndUnits\n",
      " |  \n",
      " |  MResolution\n",
      " |  \n",
      " |  MTolerance\n",
      " |  \n",
      " |  PCSCode\n",
      " |  \n",
      " |  PCSName\n",
      " |  \n",
      " |  VCS\n",
      " |  \n",
      " |  XYResolution\n",
      " |  \n",
      " |  XYTolerance\n",
      " |  \n",
      " |  ZDomain\n",
      " |  \n",
      " |  ZFalseOriginAndUnits\n",
      " |  \n",
      " |  ZResolution\n",
      " |  \n",
      " |  ZTolerance\n",
      " |  \n",
      " |  abbreviation\n",
      " |  \n",
      " |  alias\n",
      " |  \n",
      " |  angularUnitCode\n",
      " |  \n",
      " |  angularUnitName\n",
      " |  \n",
      " |  azimuth\n",
      " |  \n",
      " |  centralMeridian\n",
      " |  \n",
      " |  centralMeridianInDegrees\n",
      " |  \n",
      " |  centralParallel\n",
      " |  \n",
      " |  classification\n",
      " |  \n",
      " |  datumCode\n",
      " |  \n",
      " |  datumName\n",
      " |  \n",
      " |  domain\n",
      " |  \n",
      " |  factoryCode\n",
      " |  \n",
      " |  falseEasting\n",
      " |  \n",
      " |  falseNorthing\n",
      " |  \n",
      " |  falseOriginAndUnits\n",
      " |  \n",
      " |  flattening\n",
      " |  \n",
      " |  hasMPrecision\n",
      " |  \n",
      " |  hasXYPrecision\n",
      " |  \n",
      " |  hasZPrecision\n",
      " |  \n",
      " |  isHighPrecision\n",
      " |  \n",
      " |  latitudeOf1st\n",
      " |  \n",
      " |  latitudeOf2nd\n",
      " |  \n",
      " |  latitudeOfOrigin\n",
      " |  \n",
      " |  linearUnitCode\n",
      " |  \n",
      " |  linearUnitName\n",
      " |  \n",
      " |  longitude\n",
      " |  \n",
      " |  longitudeOf1st\n",
      " |  \n",
      " |  longitudeOf2nd\n",
      " |  \n",
      " |  longitudeOfOrigin\n",
      " |  \n",
      " |  metersPerUnit\n",
      " |  \n",
      " |  name\n",
      " |  \n",
      " |  primeMeridianCode\n",
      " |  \n",
      " |  primeMeridianName\n",
      " |  \n",
      " |  projectionCode\n",
      " |  \n",
      " |  projectionName\n",
      " |  \n",
      " |  radiansPerUnit\n",
      " |  \n",
      " |  remarks\n",
      " |  \n",
      " |  scaleFactor\n",
      " |  \n",
      " |  semiMajorAxis\n",
      " |  \n",
      " |  semiMinorAxis\n",
      " |  \n",
      " |  spheroidCode\n",
      " |  \n",
      " |  spheroidName\n",
      " |  \n",
      " |  standardParallel1\n",
      " |  \n",
      " |  standardParallel2\n",
      " |  \n",
      " |  type\n",
      " |  \n",
      " |  usage\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from arcpy.arcobjects.mixins.SpatialReferenceMixin:\n",
      " |  \n",
      " |  __eq__(self, other)\n",
      " |      Return self==value.\n",
      " |  \n",
      " |  __init__(self, item=None, vcs=-1, text=None)\n",
      " |      SpatialReference({item}, {vcs})\n",
      " |      \n",
      " |        item{String}:\n",
      " |      The spatial reference can be created in three ways: Using the name of\n",
      " |      the coordinate system  sr = arcpy.SpatialReference(\"Hawaii Albers\n",
      " |      Equal Area Conic\") Using a projection file (.prj) sr =\n",
      " |      arcpy.SpatialReference(\"c:/coordsystems/NAD 1983.prj\") Using a\n",
      " |      coordinate system's factory code (or authority code)   # 32145 is the\n",
      " |      code for:\n",
      " |      #  NAD 1983 StatePlane Vermont FIPS 4400 (Meters)\n",
      " |      sr = arcpy.SpatialReference(32145)\n",
      " |      \n",
      " |      For more information on coordinate system names and factory codes,\n",
      " |      see geographic_coordinate_systems.pdf and\n",
      " |      projected_coordinate_systems.pdf files in the ArcGIS Documentation\n",
      " |      folder.\n",
      " |      \n",
      " |        vcs{String / long}:\n",
      " |      A vertical coordinate system is associated with the coordinate system.\n",
      " |      \n",
      " |      For more information, see Using the spatial reference class .\n",
      " |  \n",
      " |  __ne__(self, other)\n",
      " |      Return self!=value.\n",
      " |  \n",
      " |  __reduce__(self)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from arcpy.arcobjects.mixins.SpatialReferenceMixin:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from arcpy.arcobjects.mixins.SpatialReferenceMixin:\n",
      " |  \n",
      " |  __hash__ = None\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from arcpy.arcobjects._base._BaseArcObject:\n",
      " |  \n",
      " |  __cmp__(self, other)\n",
      " |  \n",
      " |  __repr__(self)\n",
      " |      Return repr(self).\n",
      " |  \n",
      " |  __str__(self)\n",
      " |      Return str(self).\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(arcpy.SpatialReference)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Geographic Coordinate System)\">name (Geographic Coordinate System)</td><td title=\"GCS_WGS_1984\">GCS_WGS_1984</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"4326\">4326</td></tr><tr><td id = \"td0\" title=\"angularUnitName (Angular Unit)\">angularUnitName (Angular Unit)</td><td title=\"Degree\">Degree</td></tr><tr><td id = \"td0\" title=\"datumName (Datum)\">datumName (Datum)</td><td title=\"D_WGS_1984\">D_WGS_1984</td></tr></table>"
      ],
      "text/plain": [
       "<SpatialReference object at 0x1ef7f1f1648[0x1ef6038d710]>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arcpy.SpatialReference(\"../data/beijing/bj_area.prj\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Geographic Coordinate System)\">name (Geographic Coordinate System)</td><td title=\"GCS_WGS_1984\">GCS_WGS_1984</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"4326\">4326</td></tr><tr><td id = \"td0\" title=\"angularUnitName (Angular Unit)\">angularUnitName (Angular Unit)</td><td title=\"Degree\">Degree</td></tr><tr><td id = \"td0\" title=\"datumName (Datum)\">datumName (Datum)</td><td title=\"D_WGS_1984\">D_WGS_1984</td></tr></table>"
      ],
      "text/plain": [
       "<SpatialReference object at 0x1ef7f1cf108[0x1ef6038dcb0]>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arcpy.SpatialReference(4326)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Projected Coordinate System)\">name (Projected Coordinate System)</td><td title=\"CGCS2000_3_Degree_GK_CM_117E\">CGCS2000_3_Degree_GK_CM_117E</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"4548\">4548</td></tr><tr><td id = \"td0\" title=\"linearUnitName (Linear Unit)\">linearUnitName (Linear Unit)</td><td title=\"Meter\">Meter</td></tr></table><div class=\"subtitle\">spatialReference.GCS</div><style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Geographic Coordinate System)\">name (Geographic Coordinate System)</td><td title=\"GCS_China_Geodetic_Coordinate_System_2000\">GCS_China_Geodetic_Coordinate_System_2000</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"4490\">4490</td></tr><tr><td id = \"td0\" title=\"angularUnitName (Angular Unit)\">angularUnitName (Angular Unit)</td><td title=\"Degree\">Degree</td></tr><tr><td id = \"td0\" title=\"datumName (Datum)\">datumName (Datum)</td><td title=\"D_China_2000\">D_China_2000</td></tr></table>"
      ],
      "text/plain": [
       "<SpatialReference object at 0x1ef7f1b24c8[0x1ef6038db70]>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arcpy.SpatialReference(4548)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Projected Coordinate System)\">name (Projected Coordinate System)</td><td title=\"Asia_Lambert_Conformal_Conic\">Asia_Lambert_Conformal_Conic</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"102012\">102012</td></tr><tr><td id = \"td0\" title=\"linearUnitName (Linear Unit)\">linearUnitName (Linear Unit)</td><td title=\"Meter\">Meter</td></tr></table><div class=\"subtitle\">spatialReference.GCS</div><style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Geographic Coordinate System)\">name (Geographic Coordinate System)</td><td title=\"GCS_WGS_1984\">GCS_WGS_1984</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"4326\">4326</td></tr><tr><td id = \"td0\" title=\"angularUnitName (Angular Unit)\">angularUnitName (Angular Unit)</td><td title=\"Degree\">Degree</td></tr><tr><td id = \"td0\" title=\"datumName (Datum)\">datumName (Datum)</td><td title=\"D_WGS_1984\">D_WGS_1984</td></tr></table>"
      ],
      "text/plain": [
       "<SpatialReference object at 0x1ef7f1b7ec8[0x1ef6038d910]>"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arcpy.SpatialReference(\"Asia_Lambert_Conformal_Conic\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Geographic Coordinate System)\">name (Geographic Coordinate System)</td><td title=\"GCS_WGS_1984\">GCS_WGS_1984</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"4326\">4326</td></tr><tr><td id = \"td0\" title=\"angularUnitName (Angular Unit)\">angularUnitName (Angular Unit)</td><td title=\"Degree\">Degree</td></tr><tr><td id = \"td0\" title=\"datumName (Datum)\">datumName (Datum)</td><td title=\"D_WGS_1984\">D_WGS_1984</td></tr></table><div class=\"subtitle\">spatialReference.VCS</div><style>table td#td0  {font-weight: bold}</style><table class=\"notebook\"><colgroup><col style=\"width:45%\"></col><col style=\"width:55%\"></col></colgroup><tr><td id = \"td0\" title=\"name (Vertical Coordinate System)\">name (Vertical Coordinate System)</td><td title=\"WGS_1984\">WGS_1984</td></tr><tr><td id = \"td0\" title=\"factoryCode (WKID)\">factoryCode (WKID)</td><td title=\"115700\">115700</td></tr><tr><td id = \"td0\" title=\"linearUnitName (Linear Unit)\">linearUnitName (Linear Unit)</td><td title=\"Meter\">Meter</td></tr><tr><td id = \"td0\" title=\"direction (Direction)\">direction (Direction)</td><td title=\"1\">1</td></tr><tr><td id = \"td0\" title=\"datumName (Datum)\">datumName (Datum)</td><td title=\"D_WGS_1984\">D_WGS_1984</td></tr></table>"
      ],
      "text/plain": [
       "<SpatialReference object at 0x1ef7f5b18c8[0x1ef6038dfb0]>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wkt = \"GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],\\\n",
    "               PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],\\\n",
    "               VERTCS['WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],\\\n",
    "               PARAMETER['Vertical_Shift',0.0],PARAMETER['Direction',1.0],UNIT['Meter',1.0]];\\\n",
    "               -400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;\\\n",
    "               0.001;0.001;IsHighPrecision\"\n",
    "sr = arcpy.SpatialReference()\n",
    "sr.loadFromString(wkt)\n",
    "sr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import psycopg2,pandas"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 下面这个读取SDE的内容，是我本机的，没有安装的同学肯定跑不了"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "db_conn_config = {\n",
    "          'host': 'localhost',\n",
    "          'user': 'sde',\n",
    "          'password': 'sde',\n",
    "          'dbname': 'sde',\n",
    "          'port': 5432\n",
    "      }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "conn = psycopg2.connect(**db_conn_config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "sql = \"SELECT * FROM public.sde_spatial_references\tWHERE srid=4326\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "sr = pandas.read_sql_query(sql,con=conn)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "srid                                                            4326\n",
       "sr_name                                                         None\n",
       "description                                                     None\n",
       "falsex                                                        -400.0\n",
       "falsey                                                        -400.0\n",
       "xyunits                                                 1000000000.0\n",
       "falsez                                                     -100000.0\n",
       "zunits                                                       10000.0\n",
       "falsem                                                     -100000.0\n",
       "munits                                                       10000.0\n",
       "xycluster_tol                                                    0.0\n",
       "zcluster_tol                                                   0.001\n",
       "mcluster_tol                                                   0.001\n",
       "object_flags                                                  589825\n",
       "srtext             GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHER...\n",
       "min_x                                                           None\n",
       "min_y                                                           None\n",
       "min_z                                                           None\n",
       "min_m                                                           None\n",
       "max_x                                                           None\n",
       "max_y                                                           None\n",
       "max_z                                                           None\n",
       "max_m                                                           None\n",
       "cs_id                                                           4326\n",
       "cs_name                                                         None\n",
       "cs_type                                                         None\n",
       "organization                                                    EPSG\n",
       "org_coordsys_id                                                 None\n",
       "Name: 0, dtype: object"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sr.iloc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "srid                                                            3857\n",
       "sr_name                                                         None\n",
       "description                                                     None\n",
       "falsex                                                   -20037700.0\n",
       "falsey                                                   -30241100.0\n",
       "xyunits                                                      10000.0\n",
       "falsez                                                     -100000.0\n",
       "zunits                                                       10000.0\n",
       "falsem                                                     -100000.0\n",
       "munits                                                       10000.0\n",
       "xycluster_tol                                                  0.001\n",
       "zcluster_tol                                                   0.001\n",
       "mcluster_tol                                                   0.001\n",
       "object_flags                                                  589825\n",
       "srtext             PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere...\n",
       "min_x                                                           None\n",
       "min_y                                                           None\n",
       "min_z                                                           None\n",
       "min_m                                                           None\n",
       "max_x                                                           None\n",
       "max_y                                                           None\n",
       "max_z                                                           None\n",
       "max_m                                                           None\n",
       "cs_id                                                           3857\n",
       "cs_name                                                         None\n",
       "cs_type                                                         None\n",
       "organization                                                    EPSG\n",
       "org_coordsys_id                                                 None\n",
       "Name: 0, dtype: object"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sr = pandas.read_sql_query(\"SELECT * FROM public.sde_spatial_references\tWHERE srid=3857\",\n",
    "con=conn)\n",
    "sr.iloc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7.11 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.11"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "06b308fdbfd5979111721ebbf4de1ae2cbf405c7740d4ab5c57cb4c3e518bed6"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
